<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link th:replace="fragments/dependency :: edit-css">

<title>优铺Admin</title>
</head>

<body style="background: #fff; margin-top: 7px;">
	
<div class="right_col" style="background:#F7F7F7">
	<div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>更新角色 </h2>
                    
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                    <br>
                    <form id="demo-form2"  class="form-horizontal form-label-left">
					  <div class="form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12">
                        编号 <span class="required" th:text="${entity.id}"></span>
                        
                        </label>
                        <input type="hidden" name="id" th:value="${entity.id}" />
                      </div>
                      <div class="form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" >
                        角色名称 <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input type="text" name="roleName" th:value="${entity.roleName}" required="required" class="form-control col-md-7 col-xs-12">
                        </div>
                      </div>
                      
                      <div class="ln_solid"></div>
                      <div class="form-group">
                        <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
						  <button class="btn btn-primary" type="reset">重置</button>
                          <button type="button" id="save" class="btn btn-success hide" permission-rel="/sysRole/add">提交</button>
                        </div>
                      </div>

                    </form>
                  </div>
                </div>
              </div>
            </div>
</div>
<div th:replace="fragments/dependency :: edit-js"></div>
	<script type="text/javascript">
	var add={
			init:function(){
				add.initValidate();
				$("#save").on('click', function() {
					$('form').submit();
				});
			},
			initValidate : function() {
				formValidator.rules = {

				};

				formValidator.fields = {
					roleName : 'required;length(~8);',
				};
				//表单提交的实体获取函数
				formValidator.getEntity = function() {
					return {
						roleName : $("input[name=roleName]").val(),
						status:100
					};
				}
				//初始化验证路径以及回调函数
				formValidator.init('/sysRole/update/?id='+$('input[name=id]').val(), function(data) {
					if (data.id > 0) {
						adminLayer.alert({
							content : '更新成功',
							yes : function() {
								window.parent.location.reload();
							},
							end : function() {
								
							}
						});
					}
				});
			}
	}
	add.init();
	</script>
	
	<script th:replace="fragments/detailForm :: detailForm"></script>
</body>
</html>
